<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        {include file="public/header"}
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label for="L_email" class="layui-form-label">
                            <span class="x-red">*</span>登录名</label>
                        <div class="layui-input-inline">
                            <input type="text" name="name" value="{$Think.session.admin_info.name}" required="" lay-verify="required"  autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>必填</div>
                    </div>
                    <div class="layui-form-item">
                        <label for="L_email" class="layui-form-label">
                            <span class="x-red">*</span>登录密码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="password" required="" lay-verify="required" autocomplete="off" class="layui-input"></div>
                        <div class="layui-form-mid layui-word-aux">
                            <span class="x-red">*</span>必填</div>
                    </div>
                    <input type="hidden" name="id" value="{$Think.session.admin_info.id}">
                    <div class="layui-form-item">
                        <label for="L_repass" class="layui-form-label"></label>
                        <button class="layui-btn" lay-filter="add" lay-submit="">修改</button></div>
                </form>
            </div>
        </div>
        <script>layui.use(['form', 'layer','jquery'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                layer = layui.layer;
                //监听提交
                form.on('submit(add)',
                function(data) {
                    $.ajax({
                      url: "{:url('account/admin_info')}",
                      data: data.field,
                      type: 'post',
                      dataType: "json",
                      async: false,
                      success: function (response) {
                          if (response.code == '200') {
                              //发异步，把数据提交给php
                                layer.alert("修改成功", {
                                    icon: 6
                                },
                                function() {
                                    //关闭当前frame
                                    xadmin.close();

                                    // 可以对父窗口进行刷新 
                                    xadmin.father_reload();
                                });
                          } else {
                              layer.msg(response.msg);
                              return false;
                          }
                      }
                    })
                    
                    return false;
                });

            });
        </script>
    </body>

</html>